<div class="box-body table-responsive no-padding">
    <table class="table">
        <thead>
        <tr>
            <th></th>
            <th>日期</th>
            <th>站点</th>
            <th>国家</th>
            <th>来源</th>
            <th>订单号</th>
            <th>SKU</th>
            <th>品名</th>
            <th>品类</th>
            <th>平台SKU</th>
            <th>反馈内容</th>
            <th>标签</th>
            <th>标签</th>
            <th>图片</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        @foreach($paginator as $row)
            <tr>
                <td>
                    @if($row->status != 1)
                        <input type="checkbox" class="grid-row-checkbox" data-id="{{ $row->id }}" />
                    @endif
                </td>
                <td><span style="font-size: 85%;padding: .2em 0 .3em;">{{ $row->report_date }}</span></td>
                <td>{{ $row->area->area ?? '' }}</td>
                <td>{{ $row->country->country ?? '' }}</td>
                <td>{{ \App\Models\Quality\QComplaint::$_origin[$row->origin] }}</td>
                <td><span style="font-size: 85%;padding: .2em 0 .3em;">{{ $row->order_no }}</span></td>
                <td>{{ $row->sku->psku_code ?? '' }}</td>
                <td><span style="font-size: 85%;padding: .2em 0 .3em;">{{ $row->sku->psku_cn ?? '' }}</span></td>
                <td><span style="font-size: 85%;padding: .2em 0 .3em;">{{ $row->classify->title ?? '' }}</span></td>
                <td><span class="label" style="color: #000;font-weight: 500;font-size: 85%;padding: .2em 0 .3em;">{{ $row->seller_sku }}</span></td>
                <td><span style="font-size: 85%;padding: .2em 0 .3em;white-space: pre-wrap;">{!! $row->content !!}</span></td>
                <td>
                    @if(!is_null($row->tag))
                        @foreach($row->tag as $type => $tag)
                            <span style="color: #lightblue;">{{ \App\Models\Quality\QDictTag::$_type[$type] }}</span>:
                            {!! implode(",",\App\Models\Quality\QDictTag::getTag($row->tag)) !!}
                        @endforeach 
                    @endif
                    <br/>
                </td> 
                <td> 
                    {{--@if($row->status == 0 && \Encore\Admin\Facades\Admin::user()->can('complaint.calculate'))--}}

                    @if($row->status == 0)
                        <a href="javascript:void(0);" class="my-modal" data-id="{{ $row->id }}"
                           data-action="editTag">
                            @if(!is_null($row->tag))
                                {!! implode("&nbsp;",\App\Models\Quality\QDictTag::getTag($row->tag)) !!}
                            @else
                                <i class="fa fa-pencil"></i>
                            @endif
                        </a>
                    @else
                        @if(!is_null($row->tag))
                            <span style="font-size: 85%;padding: .2em 0 .3em;">{!! implode("&nbsp;",\App\Models\Quality\QDictTag::getTag($row->tag)) !!}</span>
                        @endif
                    @endif
                </td>
                @if($row->image && $row->image->pics)
                    <td><span style="font-size: 85%;padding: .2em 0 .3em;">{!! \App\Models\Product\ProductSku::getMultipleImage($row->image->pics,50,50) !!}</span></td>
                @else
                    <td></td>
                @endif
                <td>
                    @if($row->status != 1)
                        <a href="/xqc/quality/complaint/{{ $row->id }}/edit" class="btn btn-xs btn-info">编辑</a>
                    @else
                        <button class="btn btn-xs btn-danger" disabled>编辑</button>
                    @endif
                </td>
{{--                <td><span class="label" style="color: #000;font-weight: 500;font-size: 85%;padding: .2em 0 .3em;">{{ \App\Models\Quality\QComplaint::$_status[$row->status] }}</span></td>--}}
            </tr>
        @endforeach
        </tbody>
    </table>
</div>
<div class="modal fade" id="myModal">
    <div class="modal-dialog">
        <div class="modal-content">
            <!-- 内容会加载到这里 -->
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script language="JavaScript" type="text/javascript">
    $(function () {
        $('.grid-row-checkbox').iCheck({checkboxClass:'icheckbox_minimal-blue'}).on('ifChanged', function () {
            if (this.checked) {
                $(this).closest('tr').css('background-color', '#ffffd5');
            } else {
                $(this).closest('tr').css('background-color', '');
            }
        });
        //更新Tag
        $('.my-modal').on('click', function(e) {
            e.preventDefault();
            var id = $(this).data('id');
            var action = $(this).data('action');
            $("#myModal").modal({
                remote : '/xqc/quality/complaint-modal?action=' + action + '&param=' + id
            });
        });
        $("#myModal").on("hidden.bs.modal", function() {
            $(this).removeData("bs.modal");
            $(this).find(".modal-content").children().remove();
        });
    });
</script>
